//package com.gk.springauth2gateway.config;
//
//import com.gk.springauth2gateway.filter.AuthFilter;
//import org.springframework.boot.web.servlet.FilterRegistrationBean;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.core.Ordered;
//import org.springframework.web.cors.CorsConfiguration;
//import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
//import org.springframework.web.filter.CorsFilter;
//
///**
// * @author Administrator
// * @version 1.0
// **/
//@Configuration
//public class ZuulConfig {
//
//    @Bean
//    public AuthFilter preFileter() {
//        return new AuthFilter();
//    }
//
//    @Bean
//    public FilterRegistrationBean corsFilter() {
//        final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
//        final CorsConfiguration config = new CorsConfiguration();
//        config.setAllowCredentials(true);
//        config.addAllowedOrigin("*");
//        config.addAllowedHeader("*");
//        config.addAllowedMethod("*");
//        config.setMaxAge(18000L);
//        source.registerCorsConfiguration("/**", config);
//        CorsFilter corsFilter = new CorsFilter(source);
//        FilterRegistrationBean bean = new FilterRegistrationBean(corsFilter);
//        bean.setOrder(Ordered.HIGHEST_PRECEDENCE);
//        return bean;
//    }
//}
